/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#include "stdafx.h"
#include "计算类JIT函数.h"

#include <matXX.h>
#include <graph采样.h>
#include <core/动画/curve.h>


#define DEF_OMP_FOR DEF_转字符串1(#pragma omp parallel for)

#define DEF_v3_v_加 for (int64 i = 0; i < num; ++i) p_data1[i] = vec_add(v1[i], 是否独立计算 ? v2[i] : v2[0]); break;
#define DEF_v3_v_减 for (int64 i = 0; i < num; ++i) p_data1[i] = vec_sub(v1[i], 是否独立计算 ? v2[i] : v2[0]); break;
#define DEF_v3_v_乘 for (int64 i = 0; i < num; ++i) p_data1[i] = vec_mul(v1[i], 是否独立计算 ? v2[i] : v2[0]); break;
#define DEF_v3_v_除 for (int64 i = 0; i < num; ++i) p_data1[i] = vec_div(v1[i], 是否独立计算 ? v2[i] : v2[0]); break;
#define DEF_v3_v3_叉积 for (int64 i = 0; i < num; ++i) p_data1[i] = vec_cross(v1[i], 是否独立计算 ? v2[i] : v2[0]); break;
//#define DEF_v3s_v3s_叉积 for (int64 i = 0; i < num; ++i) p_data1[i] = vec_cross(v1[i], 是否独立计算 ? v2[i] : v2[i]); break;



vec3 f_JIT_Fun_vec3_c_f32(DEF_V3_F_参数) {
	switch (计算方式) {
	case 0: return vec_add(data1, data2);
	case 1: return vec_sub(data1, data2);
	case 2: return vec_mul(data1, data2);
	case 3: return vec_div(data1, data2);
	}
	return {};
}

vec3 f_JIT_Fun_vec3_c_vec3(DEF_V3_V3_参数) {
	switch (计算方式) {
	case 0: return vec_add(data1, data2);
	case 1: return vec_sub(data1, data2);
	case 2: return vec_mul(data1, data2);
	case 3: return vec_div(data1, data2);
	case 4: return vec_cross(data1, data2);
	case 5: return vec_cross(data1, data2);
	}
	return {};
}



void f_JIT_Fn_三角函数s(S_F32Array* inData, S_F32Array* outData, uint8 type) {
	uint32 num = inData->count;
	f_core_array_resize((S_Array*)outData, num);

	float32* inptr = inData->ptr_userData;
	float32* outptr = outData->ptr_userData;

	for (uint32 i = 0; i < num; ++i) {
		switch (type) {
		case 0: outptr[i] = sinf(inptr[i]); break;
		case 1: outptr[i] = cosf(inptr[i]); break;
		case 2: outptr[i] = tanf(inptr[i]); break;

		case 3: outptr[i] = asinf(inptr[i]); break;
		case 4: outptr[i] = acosf(inptr[i]); break;
		case 5: outptr[i] = atanf(inptr[i]); break;

		case 6: outptr[i] = sinhf(inptr[i]); break;
		case 7: outptr[i] = coshf(inptr[i]); break;
		case 8: outptr[i] = tanhf(inptr[i]); break;

		case 9: outptr[i] = asinhf(inptr[i]); break;
		case 10: outptr[i] = acoshf(inptr[i]); break;
		case 11: outptr[i] = atanhf(inptr[i]); break;
		default:
			break;
		}
	}
}

float32 f_JIT_Fn_三角函数(float32 inData, uint8 type) {
	switch (type) {
	case 0: return sinf(inData); 
	case 1: return cosf(inData); 
	case 2: return tanf(inData); 
			
	case 3: return asinf(inData); 
	case 4: return acosf(inData); 
	case 5: return atanf(inData); 
			
	case 6: return sinhf(inData); 
	case 7: return coshf(inData); 
	case 8: return tanhf(inData); 
			
	case 9: return asinhf(inData);
	case 10:return acoshf(inData);
	case 11:return atanhf(inData);
	default:
		break;
	}
	return 0;
}

void f_JIT_Fn_向量归一化s(S_Vec3Array* inData, S_Vec3Array* outData) {
	uint32 num = inData->count;
	f_core_array_resize((S_Array*)outData, num);

	vec3* inptr = inData->ptr_userData;
	vec3* outptr = outData->ptr_userData;

	for (uint32 i = 0; i < num; ++i) {
		outptr[i] = vec_normalize(inptr[i]);
	}
}

void f_JIT_Fn_逻辑计算m(S_F32Array* inDataA, S_F32Array* inDataB, S_I8Array* outData, uint8 方式) {
	uint32 num = DEF_Max(inDataA->count, inDataB->count);

	bool 独立A = inDataA->count >= num;
	bool 独立B = inDataB->count >= num;

	f_core_array_resize((S_Array*)outData, num);

	float32* ap = inDataA->ptr_userData;
	float32* bp = inDataB->ptr_userData;
	int8* rp = outData->ptr_userData;

//#pragma omp parallel for
	for (int32 i = 0; i < num; ++i) {
		switch (方式) {
			case 0: rp[i] = (独立A ? ap[i] : ap[0]) > (独立B ? bp[i] : bp[0]); break;
			case 1: rp[i] = (独立A ? ap[i] : ap[0]) < (独立B ? bp[i] : bp[0]); break;
			case 2: rp[i] = (独立A ? ap[i] : ap[0]) >= (独立B ? bp[i] : bp[0]); break;
			case 3: rp[i] = (独立A ? ap[i] : ap[0]) <= (独立B ? bp[i] : bp[0]); break;
			case 4: rp[i] = (独立A ? ap[i] : ap[0]) == (独立B ? bp[i] : bp[0]); break;
			case 5: rp[i] = (独立A ? ap[i] : ap[0]) != (独立B ? bp[i] : bp[0]); break;
			case 6: rp[i] = (独立A ? ap[i] : ap[0]) && (独立B ? bp[i] : bp[0]); break;
			case 7: rp[i] = (独立A ? ap[i] : ap[0]) || (独立B ? bp[i] : bp[0]); break;
		}
	}
}

void f_JIT_Fn_逻辑计算(float32 inDataA, float32 inDataB, int8& outData, uint8 方式) {
	switch (方式) {
		case 0: outData = inDataA >  inDataB; break;
		case 1: outData = inDataA <  inDataB; break;
		case 2: outData = inDataA >= inDataB; break;
		case 3: outData = inDataA <= inDataB; break;
		case 4: outData = inDataA == inDataB; break;
		case 5: outData = inDataA != inDataB; break;
		case 6: outData = inDataA && inDataB; break;
		case 7: outData = inDataA || inDataB; break;
	}
}


void f_JIT_Fn_矢量逻辑计算m(S_Vec3Array* inDataA, S_Vec3Array* inDataB, S_I8Array* outData, uint8 方式) {
	uint32 num = DEF_Max(inDataA->count, inDataB->count);

	bool 独立A = inDataA->count >= num;
	bool 独立B = inDataB->count >= num;

	f_core_array_resize((S_Array*)outData, num);

	vec3* ap = inDataA->ptr_userData;
	vec3* bp = inDataB->ptr_userData;
	int8* rp = outData->ptr_userData;

	//for (uint32 i = 0; i < num; ++i) {
	//	switch (方式) {
	//		case 0: rp[i] = 独立A ? ap[i] : ap[0] > 独立B ? bp[i] : bp[0]; break;
	//		case 1: rp[i] = 独立A ? ap[i] : ap[0] < 独立B ? bp[i] : bp[0]; break;
	//		case 2: rp[i] = 独立A ? ap[i] : ap[0] >= 独立B ? bp[i] : bp[0]; break;
	//		case 3: rp[i] = 独立A ? ap[i] : ap[0] <= 独立B ? bp[i] : bp[0]; break;
	//		case 4: rp[i] = 独立A ? ap[i] : ap[0] == 独立B ? bp[i] : bp[0]; break;
	//		case 5: rp[i] = 独立A ? ap[i] : ap[0] != 独立B ? bp[i] : bp[0]; break;
	//		case 6: rp[i] = 独立A ? ap[i] : ap[0] && 独立B ? bp[i] : bp[0]; break;
	//		case 7: rp[i] = 独立A ? ap[i] : ap[0] || 独立B ? bp[i] : bp[0]; break;
	//	}
	//}
}
void f_JIT_Fn_矢量逻辑计算(const vec3& inDataA, const vec3& inDataB, int8& outData, uint8 方式) {
	//switch (方式) {
	//	case 0: outData = inDataA > inDataB; break;
	//	case 1: outData = inDataA < inDataB; break;
	//	case 2: outData = inDataA >= inDataB; break;
	//	case 3: outData = inDataA <= inDataB; break;
	//	case 4: outData = inDataA == inDataB; break;
	//	case 5: outData = inDataA != inDataB; break;
	//	case 6: outData = inDataA && inDataB; break;
	//	case 7: outData = inDataA || inDataB; break;
	//}
}




vec3 f_JIT_Fn_设置矢量分量(const vec3& 矢量, float32 分量, int8 分量ID) {
	vec3 新矢量 = 矢量;
	((float32*)&新矢量)[DEF_Min(DEF_Max(分量ID, 0), 2)] = 分量;

	switch (分量ID) {
		case 0: 新矢量.x = 分量; break;
		case 1: 新矢量.y = 分量; break;
		case 2: 新矢量.z = 分量; break;
	}

	return 新矢量;
}

void f_JIT_Fn_设置矢量分量m(const S_Vec3Array* 矢量, const S_F32Array* 分量, int8 分量ID, S_Vec3Array* 返回矢量) {
	uint32 num = DEF_Max(矢量->count, 分量->count);

	bool 源矢量单例 = 矢量->count < num;
	bool 源分量单例 = 分量->count < num;

	f_core_array_resize((S_Array*)返回矢量, num);

	for (uint32 i = 0; i < num; ++i) {
		vec3 v = 源矢量单例 ? 矢量->ptr_userData[0] : 矢量->ptr_userData[i];

		switch (分量ID) {	
			case 0: v.x = 源分量单例 ? 分量->ptr_userData[0] : 分量->ptr_userData[i]; break;
			case 1: v.y = 源分量单例 ? 分量->ptr_userData[0] : 分量->ptr_userData[i]; break;
			case 2: v.z = 源分量单例 ? 分量->ptr_userData[0] : 分量->ptr_userData[i]; break;
		}
		返回矢量->ptr_userData[i] = v;
	}
}

void f_JIT_Fn_混合m(const S_F32Array* a, const S_F32Array* b, const S_F32Array* c, S_F32Array* 返回矢量) {
	uint32 num = DEF_Max(a->count, b->count);
	num = DEF_Max(num, c->count);

	f_core_array_resize((S_Array*)返回矢量, num);

	bool a独立 = a->count >= num;
	bool b独立 = b->count >= num;
	bool c独立 = c->count >= num;

	for (uint32 i = 0; i < num; ++i) {
		返回矢量->ptr_userData[i] = mix(
			a独立 ? a->ptr_userData[i] : a->ptr_userData[0],
			b独立 ? b->ptr_userData[i] : b->ptr_userData[0],
			clamp(c独立 ? c->ptr_userData[i] : c->ptr_userData[0], 0, 1)
		);
	}
}

void f_JIT_Fn_矢量混合m(const S_Vec3Array* a, const S_Vec3Array* b, const S_F32Array* c, S_Vec3Array* 返回矢量) {
	uint32 num = DEF_Max(a->count, b->count);
	num = DEF_Max(num, c->count);

	f_core_array_resize((S_Array*)返回矢量, num);

	bool a独立 = a->count >= num;
	bool b独立 = b->count >= num;
	bool c独立 = c->count >= num;

	for (uint32 i = 0; i < num; ++i) {
		返回矢量->ptr_userData[i] = mix(
			a独立 ? a->ptr_userData[i] : a->ptr_userData[0],
			b独立 ? b->ptr_userData[i] : b->ptr_userData[0],
			clamp(c独立 ? c->ptr_userData[i] : c->ptr_userData[0], 0, 1)
		);
	}
}

#define DEF_V3S_Fs_参数 const S_Vec3Array* data1, const S_F32Array* data2, S_Vec3Array* r, uint8 计算方式
static void f_JIT_Fun_vec3s_c_fs(DEF_V3S_Fs_参数) {
	vec3* v1 = data1->ptr_userData;
	float32* v2 = data2->ptr_userData;

	uint32 num = data1->count;
	uint32 num2 = data2->count;

	f_core_array_resize((S_Array*)r, num);
	((std::vector<vec3>*)r)->resize(num);
	vec3* p_data1 = r->ptr_userData;


	bool 是否独立计算 = false;
	if (num2 >= num) {
		是否独立计算 = true;
	}

	switch (计算方式) {
	case 0: {
#pragma omp parallel for
		DEF_v3_v_加
	}
	case 1: {
#pragma omp parallel for
		DEF_v3_v_减
	}
	case 2: {
#pragma omp parallel for
		DEF_v3_v_乘
	}
	case 3: {
#pragma omp parallel for
		DEF_v3_v_除
	}
	case 4: {
		std::cout << "vec3 该选项不能计算" << std::endl;
		break;
	}
	case 5: {
		break;
	}
	case 6: {

		break;
	}
	case 7: {
		break;
	}
	}

}


#define DEF_V3s_V3s_参数 const S_Vec3Array* data1, const S_Vec3Array* data2, S_Vec3Array* r, uint8 计算方式
static void f_JIT_Fun_vec3s_c_vec3s(DEF_V3s_V3s_参数) {
	vec3* v1 = data1->ptr_userData;
	vec3* v2 = data2->ptr_userData;

	uint32 num = DEF_Max(data1->count, data2->count);
	if(!num) return;
	
	f_core_array_resize((S_Array*)r, num);
	vec3* p_outData = r->ptr_userData;

	
	bool 插座1单例 = data1->count < num;
	bool 插座2单例 = data2->count < num;

	if (num > 100000000) {
		switch (计算方式) {
		case 0: {
#pragma omp parallel for
			for (int64 i = 0; i < num; ++i) {
				p_outData[i] = vec_add(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
			}
		}
		case 1: {
#pragma omp parallel for
			for (int64 i = 0; i < num; ++i) {
				p_outData[i] = vec_sub(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
			}
		}
		case 2: {
#pragma omp parallel for
			for (int64 i = 0; i < num; ++i) {
				p_outData[i] = vec_mul(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
			}
		}
		case 3: {
#pragma omp parallel for
			for (int64 i = 0; i < num; ++i) {
				p_outData[i] = vec_div(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
			}
		}
		case 4: {
#pragma omp parallel for
			for (int64 i = 0; i < num; ++i) {
				p_outData[i] = vec_cross(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
			}
			break;
		}
		}
	}
	else {
		switch (计算方式) {
		case 0: {
			for (int64 i = 0; i < num; ++i) {
				p_outData[i] = vec_add(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
			}
			break;
		}
		case 1: {
			for (int64 i = 0; i < num; ++i) {
				p_outData[i] = vec_sub(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
			}
			break;
		}
		case 2: {
			for (int64 i = 0; i < num; ++i) {
				p_outData[i] = vec_mul(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
			}
			break;
		}
		case 3: {
			for (int64 i = 0; i < num; ++i) {
				p_outData[i] = vec_div(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
			}
			break;
		}
		case 4: {
			for (int64 i = 0; i < num; ++i) {
				p_outData[i] = vec_cross(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
			}
			break;
		}
		}
	}
}

//static void f_JIT_Fun_vec3s_c_vec3s(const S_iVec3Array* data1, const S_iVec3Array* data2, S_iVec3Array* r, uint8 计算方式) {
//	ivec3* v1 = data1->ptr_userData;
//	ivec3* v2 = data2->ptr_userData;
//
//	uint32 num = DEF_Max(data1->count, data2->count);
//
//	f_core_array_resize((S_Array*)r, num);
//	ivec3* p_outData = r->ptr_userData;
//
//
//	bool 插座1单例 = data1->count < num;
//	bool 插座2单例 = data2->count < num;
//
//	if (num > 100000000) {
//		switch (计算方式) {
//			case 0: {
//			#pragma omp parallel for
//				for (int64 i = 0; i < num; ++i) {
//					p_outData[i] = vec_add(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
//				}
//			}
//			case 1: {
//			#pragma omp parallel for
//				for (int64 i = 0; i < num; ++i) {
//					p_outData[i] = vec_sub(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
//				}
//			}
//			case 2: {
//			#pragma omp parallel for
//				for (int64 i = 0; i < num; ++i) {
//					p_outData[i] = vec_mul(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
//				}
//			}
//			case 3: {
//			#pragma omp parallel for
//				for (int64 i = 0; i < num; ++i) {
//					p_outData[i] = vec_div(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
//				}
//			}
//			case 4: {
//			#pragma omp parallel for
//				for (int64 i = 0; i < num; ++i) {
//					p_outData[i] = vec_cross(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
//				}
//				break;
//			}
//		}
//	}
//	else {
//		switch (计算方式) {
//			case 0: {
//				for (int64 i = 0; i < num; ++i) {
//					p_outData[i] = vec_add(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
//				}
//				break;
//			}
//			case 1: {
//				for (int64 i = 0; i < num; ++i) {
//					p_outData[i] = vec_sub(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
//				}
//				break;
//			}
//			case 2: {
//				for (int64 i = 0; i < num; ++i) {
//					p_outData[i] = vec_mul(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
//				}
//				break;
//			}
//			case 3: {
//				for (int64 i = 0; i < num; ++i) {
//					p_outData[i] = vec_div(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
//				}
//				break;
//			}
//			case 4: {
//				for (int64 i = 0; i < num; ++i) {
//					p_outData[i] = vec_cross(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
//				}
//				break;
//			}
//		}
//	}
//}

void f_JIT_Fun_两向量计算向量(const S_Vec3Array* data1, const S_Vec3Array* data2, const S_UI32Array* index, S_Vec3Array* r, uint8 计算方式) {
	vec3* v1 = data1->ptr_userData;
	vec3* v2 = data2->ptr_userData;

	uint32 num = DEF_Max(data1->count, data2->count);

	f_core_array_resize((S_Array*)r, num);
	vec3* p_outData = r->ptr_userData;


	bool 插座1单例 = data1->count < num;
	bool 插座2单例 = data2->count < num;

	if (num > 100000000) {
		switch (计算方式) {
			case 0: {
			#pragma omp parallel for
				for (int64 i = 0; i < num; ++i) {
					p_outData[i] = vec_add(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
				}
			}
			case 1: {
			#pragma omp parallel for
				for (int64 i = 0; i < num; ++i) {
					p_outData[i] = vec_sub(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
				}
			}
			case 2: {
			#pragma omp parallel for
				for (int64 i = 0; i < num; ++i) {
					p_outData[i] = vec_mul(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
				}
			}
			case 3: {
			#pragma omp parallel for
				for (int64 i = 0; i < num; ++i) {
					p_outData[i] = vec_div(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
				}
			}
			case 4: {
			#pragma omp parallel for
				for (int64 i = 0; i < num; ++i) {
					p_outData[i] = vec_cross(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
				}
				break;
			}
		}
	}
	else {
		switch (计算方式) {
			case 0: {
				for (int64 i = 0; i < num; ++i) {
					p_outData[i] = vec_add(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
				}
				break;
			}
			case 1: {
				for (int64 i = 0; i < num; ++i) {
					p_outData[i] = vec_sub(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
				}
				break;
			}
			case 2: {
				for (int64 i = 0; i < num; ++i) {
					p_outData[i] = vec_mul(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
				}
				break;
			}
			case 3: {
				for (int64 i = 0; i < num; ++i) {
					p_outData[i] = vec_div(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
				}
				break;
			}
			case 4: {
				for (int64 i = 0; i < num; ++i) {
					p_outData[i] = vec_cross(插座1单例 ? v1[0] : v1[i], 插座2单例 ? v2[0] : v2[i]);
				}
				break;
			}
		}
	}
}



#define DEF_V3S_F_参数 const S_Vec3Array* data1, float32 v2, S_Vec3Array* r, uint8 计算方式
static void f_JIT_Fun_vec3s_c_f(DEF_V3S_F_参数) {
	vec3* v1 = data1->ptr_userData;

	uint32 num = data1->count;
	f_core_array_resize((S_Array*)r, num);
	
	vec3* p_data1 = data1->ptr_userData;

	if (num > 100000000) {
		switch (计算方式) {
			case 0: {
			#pragma omp parallel for
				for (int64 i = 0; i < num; ++i) p_data1[i] = vec_add(v1[i], v2);
				break;
			}
			case 1: {
			#pragma omp parallel for
				for (int64 i = 0; i < num; ++i) p_data1[i] = vec_sub(v1[i], v2);
				break;
			}
			case 2: {
			#pragma omp parallel for
				for (int64 i = 0; i < num; ++i) p_data1[i] = vec_mul(v1[i], v2);
				break;
			}
			case 3: {
			#pragma omp parallel for
				for (int64 i = 0; i < num; ++i) p_data1[i] = vec_div(v1[i], v2);
				break;
			}
			case 4: {
				break;
			}
			case 5: {
				break;
			}
			case 6: {

				break;
			}
			case 7: {
				break;
			}
		}
	}
	else {
		switch (计算方式) {
			case 0: {
				for (int64 i = 0; i < num; ++i) p_data1[i] = vec_add(v1[i], v2);
				break;
			}
			case 1: {
				for (int64 i = 0; i < num; ++i) p_data1[i] = vec_sub(v1[i], v2);
				break;
			}
			case 2: {
				for (int64 i = 0; i < num; ++i) p_data1[i] = vec_mul(v1[i], v2);
				break;
			}
			case 3: {
				for (int64 i = 0; i < num; ++i) p_data1[i] = vec_div(v1[i], v2);
				break;
			}
			case 4: {
				break;
			}
			case 5: {
				break;
			}
			case 6: {

				break;
			}
			case 7: {
				break;
			}
		}
	}


}




#define DEF_Fs_F_F_参数 void* 参数0, float32 参数1, float32 参数2
static void* f_JIT_Fun_合并XYZ_fsff(DEF_Fs_F_F_参数) {
	float32* v0 = ((std::vector<float32>*)参数0)->data();
	uint32 num = ((std::vector<float32>*)参数0)->size();

	auto* r = new std::vector<vec3>(num);
	vec3* r_ptr = r->data();

//#pragma omp parallel for
	for (int32 i = 0; i < num; ++i) {
		r_ptr[i] = { v0[i], 参数1, 参数2 };
	}
	return r;
}

#define DEF_Fs_Fs_F_参数 void* 参数0, void* 参数1, float32 参数2
static void* f_JIT_Fun_合并XYZ_fsfsf(DEF_Fs_Fs_F_参数) {
	float32* v0 = ((std::vector<float32>*)参数0)->data();
	float32* v1 = ((std::vector<float32>*)参数1)->data();

	uint32 num = ((std::vector<float32>*)v0)->size();

	auto* r = new std::vector<vec3>(num);
	vec3* r_ptr = r->data();

//#pragma omp parallel for
	for (int32 i = 0; i < num; ++i) {
		r_ptr[i] = { v0[i], v1[i], 参数2 };
	}
	return r;
}

#define DEF_Fs_F_Fs_参数 void* 参数0, float32 参数1, void* 参数2
static void* f_JIT_Fun_合并XYZ_fsfsfs(DEF_Fs_F_Fs_参数) {
	float32* v0 = ((std::vector<float32>*)参数0)->data();
	float32* v2 = ((std::vector<float32>*)参数2)->data();

	uint32 num = ((std::vector<float32>*)v0)->size();

	auto* r = new std::vector<vec3>(num);
	vec3* r_ptr = r->data();

//#pragma omp parallel for
	for (int32 i = 0; i < num; ++i) {
		r_ptr[i] = { v0[i], 参数1, v2[i] };
	}
	return r;
}

#define DEF_Fs_Fs_Fs_参数 void* 参数0, void* 参数1, void* 参数2
static void* f_JIT_Fun_合并XYZ_fsfsfs(DEF_Fs_Fs_Fs_参数) {
	float32* v0 = ((std::vector<float32>*)参数0)->data();
	float32* v1 = ((std::vector<float32>*)参数1)->data();
	float32* v2 = ((std::vector<float32>*)参数2)->data();

	uint32 num = ((std::vector<float32>*)v0)->size();

	auto* r = new std::vector<vec3>(num);
	vec3* r_ptr = r->data();
	for (uint32 i = 0; i < num; ++i) {
		r_ptr[i] = { v0[i], v1[i], v2[i] };
	}
	return r;
}






#define DEF_构建矩阵_m_m_参数 const Mat44f& mat1, const Mat44f& mat2, uint8 m_计算方式
static Mat44f f_JIT_Fun_矩阵计算_mm(DEF_构建矩阵_m_m_参数) {
	Mat44f outMat;
	switch (m_计算方式) {
	case 0: {
		outMat = mat1 * mat2;
		break;
	}
	case 1: {
		outMat = f_mat44_Inverse(mat1);
		break;
	}
	case 2: {
		outMat = mat1;
		mat44_normalize(outMat);
		break;
	}
	}
	return outMat;
}

#define DEF_构建矩阵_m_ms_参数 const Mat44f& mat1, const void* mat2, uint8 m_计算方式
static void* f_JIT_Fun_矩阵计算_mms(DEF_构建矩阵_m_ms_参数) {
	Mat44f* m2 = (*(std::vector<Mat44f>*)mat2).data();
	uint32 num = (*(std::vector<Mat44f>*)mat2).size();

	auto r = new std::vector<Mat44f>(num);
	if (!num) return r;

	Mat44f* mat_ptr = r->data();
	bool in2单例 = (*(std::vector<Mat44f>*)mat2).size() < num;

	switch (m_计算方式) {
	case 0: {
		for (uint32 i = 0; i < num; ++i) {
			Mat44f* inMat_b;
			if (in2单例) inMat_b = &m2[0];
			else inMat_b = &m2[i];
			mat_ptr[i] = mat1 * (*inMat_b);
		}
		break;
	}
	case 1: {
		for (uint32 i = 0; i < num; ++i) {
			mat_ptr[i] = f_mat44_Inverse(mat1);
		}
		break;
	}
	case 2: {
		for (uint32 i = 0; i < num; ++i) {
			mat_ptr[i] = mat1;
			mat44_normalize(mat_ptr[i]);
		}
		break;
	}
	}
	return r;
}

#define DEF_构建矩阵_ms_m_参数 const void* mat1, const Mat44f& mat2, uint8 m_计算方式
static void* f_JIT_Fun_矩阵计算_msm(DEF_构建矩阵_ms_m_参数) {
	Mat44f* m1 = (*(std::vector<Mat44f>*)mat1).data();
	uint32 num = (*(std::vector<Mat44f>*)mat1).size();

	auto r = new std::vector<Mat44f>(num);
	if (!num) return r;

	Mat44f* mat_ptr = r->data();

	bool in1单例 = (*(std::vector<Mat44f>*)mat1).size() < num;

	switch (m_计算方式) {
	case 0: {
		for (uint32 i = 0; i < num; ++i) {
			Mat44f* inMat_a;
			if (in1单例) inMat_a = &m1[0];
			else inMat_a = &m1[i];
			mat_ptr[i] = (*inMat_a) * (mat2);
		}
		break;
	}
	case 1: {
		for (uint32 i = 0; i < num; ++i) {
			mat_ptr[i] = f_mat44_Inverse(m1[i]);
		}
		break;
	}
	case 2: {
		for (uint32 i = 0; i < num; ++i) {
			mat_ptr[i] = m1[i];
			mat44_normalize(mat_ptr[i]);
		}
		break;
	}
	}
	return r;
}

#define DEF_构建矩阵_ms_ms_参数 const void* mat1, const void* mat2, uint8 m_计算方式
static void* f_JIT_Fun_矩阵计算_msms(DEF_构建矩阵_ms_ms_参数) {
	Mat44f* m1 = (*(std::vector<Mat44f>*)mat1).data();
	Mat44f* m2 = (*(std::vector<Mat44f>*)mat2).data();

	uint32 num = (*(std::vector<Mat44f>*)mat1).size();
	uint32 num2 = (*(std::vector<Mat44f>*)mat2).size();

	num = DEF_Max(num, num2);

	auto r = new std::vector<Mat44f>(num);
	if (!num) return r;

	Mat44f* mat_ptr = r->data();

	bool in1单例 = (*(std::vector<Mat44f>*)mat1).size() < num;
	bool in2单例 = (*(std::vector<Mat44f>*)mat2).size() < num;

	switch (m_计算方式) {
	case 0: {
		for (uint32 i = 0; i < num; ++i) {
			Mat44f* inMat_a;
			Mat44f* inMat_b;

			if (in1单例) inMat_a = &m1[0];
			else inMat_a = &m1[i];

			if (in2单例) inMat_b = &m2[0];
			else inMat_b = &m2[i];

			mat_ptr[i] = (*inMat_a) * (*inMat_b);
		}
		break;
	}
	case 1: {
		for (uint32 i = 0; i < num; ++i) {
			mat_ptr[i] = f_mat44_Inverse(m1[i]);
		}
		break;
	}
	case 2: {
		for (uint32 i = 0; i < num; ++i) {
			mat_ptr[i] = m1[i];
			mat44_normalize(mat_ptr[i]);
		}
		break;
	}
	}
	return r;
}





#define DEF_构建矩阵_vs_m_参数 const void* mat1, const Mat44f& mat2
static void* f_JIT_Fun_矩阵变换_vs_m(DEF_构建矩阵_vs_m_参数) {
	vec3* v1 = (*(std::vector<vec3>*)mat1).data();
	uint32 num = (*(std::vector<vec3>*)mat1).size();

	auto r = new std::vector<vec3>(num);
	if (!num) return r;

	vec3* vec_ptr = r->data();

	for (uint32 i = 0; i < num; ++i) {
		vec_ptr[i] = mat2 * (v1[i]) ;
	}

	return r;
}

#define DEF_构建矩阵_v_ms_参数 const vec3& mat1, const void* mat2
static void* f_JIT_Fun_矩阵变换_v_ms(DEF_构建矩阵_v_ms_参数) {
	Mat44f* m2 = (*(std::vector<Mat44f>*)mat2).data();
	uint32 num = (*(std::vector<Mat44f>*)mat2).size();

	auto r = new std::vector<vec3>(num);
	if (!num) return r;

	vec3* vec_ptr = r->data();

	for (uint32 i = 0; i < num; ++i) {
		vec_ptr[i] = (m2[i]) * mat1;
	}
	return r;
}

#define DEF_构建矩阵_vs_ms_参数 const void* mat1, const void* mat2
static void* f_JIT_Fun_矩阵变换_vs_ms(DEF_构建矩阵_ms_ms_参数) {
	vec3* v1 = (*(std::vector<vec3>*)mat1).data();
	Mat44f* m2 = (*(std::vector<Mat44f>*)mat2).data();

	uint32 num = (*(std::vector<vec3>*)mat1).size();
	uint32 num2 = (*(std::vector<Mat44f>*)mat2).size();

	num = DEF_Max(num, num2);

	auto r = new std::vector<vec3>(num);
	if (!num) return r;

	vec3* vec_ptr = r->data();

	bool in1单例 = (*(std::vector<vec3>*)mat1).size() < num;
	bool in2单例 = (*(std::vector<Mat44f>*)mat2).size() < num;

	
	for (uint32 i = 0; i < num; ++i) {
		vec3* inMat_a;
		Mat44f* inMat_b;

		if (in1单例) inMat_a = &v1[0];
		else inMat_a = &v1[i];

		if (in2单例) inMat_b = &m2[0];
		else inMat_b = &m2[i];

		vec_ptr[i] = (*inMat_b) * (*inMat_a);
	}
	
	return r;
}



void f_JIT_Fun_F32s_c_F32s(S_F32Array* r, S_F32Array* a, S_F32Array* b, uint8 方式) {
	uint32 num = DEF_Max(a->count, b->count);

	if(!a->ptr_userData || !b->ptr_userData) return;

	bool in1单例 = a->count < num;
	bool in2单例 = b->count < num;
	f_core_array_resize((S_Array*)r, num);

	float32 p0;
	float32 p1;

//#pragma omp parallel for
	for (int32 i = 0; i < num; ++i) {

		if (in1单例) p0 = a->ptr_userData[0];
		else p0 = a->ptr_userData[i];

		if (in2单例) p1 = b->ptr_userData[0];
		else p1 = b->ptr_userData[i];

		switch (方式) {
		case 0: {
			r->ptr_userData[i] = p0 + p1;
			break;
		}
		case 1: {
			r->ptr_userData[i] = p0 - p1;
			break;
		}
		case 2: {
			r->ptr_userData[i] = p0 * p1;
			break;
		}
		case 3: {
			r->ptr_userData[i] = p0 / p1;
			break;
		}
		}
	}
}

void f_JIT_单值数组计算(S_I32Array* r, S_I32Array* a, S_I32Array* b, uint8 方式) {
	uint32 num = DEF_Max(a->count, b->count);

	bool in1单例 = a->count < num;
	bool in2单例 = b->count < num;
	f_core_array_resize((S_Array*)r, num);

	float32 p0;
	float32 p1;

//#pragma omp parallel for
	for (int32 i = 0; i < num; ++i) {

		if (in1单例) p0 = a->ptr_userData[0];
		else p0 = a->ptr_userData[i];

		if (in2单例) p1 = b->ptr_userData[0];
		else p1 = b->ptr_userData[i];

		switch (方式) {
			case 0: {
				r->ptr_userData[i] = p0 + p1;
				break;
			}
			case 1: {
				r->ptr_userData[i] = p0 - p1;
				break;
			}
			case 2: {
				r->ptr_userData[i] = p0 * p1;
				break;
			}
			case 3: {
				r->ptr_userData[i] = p0 / DEF_Max(p1,1);
				break;
			}
		}
	}
}





void f_JIT_旋转向量节点(S_Vec3Array* 向量, const S_Vec3Array* 法线, const S_Vec2Array* UV, uint8 方式) {
	uint32 num = DEF_Max(法线->count, UV->count);

	bool in1单例 = 法线->count < num;
	bool in2单例 = UV->count < num;

	f_core_array_resize((S_Array*)向量, num);

	vec3 a{};
	vec3 上一个顶点{};
	vec3 变换后顶点{};
	for (uint32 i = 0; i < num; ++i) {
		vec2* b;

		if (in2单例) b = &UV->ptr_userData[0];
		else b = &UV->ptr_userData[i];
		vec3 TangentSample = f_SphereSampling(*b);


		if (in1单例) a = 法线->ptr_userData[0];
		else{
			switch (方式) {
			case 1: {
				a = (法线->ptr_userData[i] - 上一个顶点);
				float32 l = vec_normalize(&a);
				a = f_SphereSampling_toWorld(TangentSample, a);
				a *= l;

				变换后顶点 += a;
				向量->ptr_userData[i] = 变换后顶点;
				上一个顶点 = 法线->ptr_userData[i];
				break;
			}
			case 2: {
				a = (法线->ptr_userData[i] - 上一个顶点);
				float32 l = vec_normalize(&a);
				a = f_SphereSampling_toWorld(TangentSample, a);
				a *= l;

				上一个顶点 += a;
				向量->ptr_userData[i] = 上一个顶点;
				break;
			}
			case 3: {
				if (i) {
					a = 法线->ptr_userData[i] - a;
				}
				else {
					a = 法线->ptr_userData[i];
				}
				a = f_SphereSampling_toWorld(TangentSample, a);
				a += 法线->ptr_userData[i];
				向量->ptr_userData[i] = a;
				break;
			}
			default:
				a = 法线->ptr_userData[i];
				向量->ptr_userData[i] = f_SphereSampling_toWorld(TangentSample, a);
				break;
			}
		}
	}
}

void f_JIT_曲线采样(S_F32Array* 值, const S_曲线& curve, const S_F32Array* 步进, const vec2& 钳制) {
	uint32 num = 步进->count;
	f_core_array_resize((S_Array*)值, num);

	for (uint32 i = 0; i < num; ++i) {
		值->ptr_userData[i] = f_graph_钳制曲线采样(步进->ptr_userData[i], curve, 钳制);
	}
}


void f_JIT_步进fm(const S_F32Array* x, const S_F32Array* y, S_F32Array* a, uint8 方式) {
	uint32 num = DEF_Max(x->count, y->count);
	f_core_array_resize((S_Array*)a, num);

	bool x多例 = x->count >= num;
	bool y多例 = y->count >= num;

	for (uint32 i = 0; i < num; ++i) {
		a->ptr_userData[i] = f_JIT_步进f(x多例 ? x->ptr_userData[i] : x->ptr_userData[0], y多例 ? y->ptr_userData[i] : y->ptr_userData[0], 方式);
	}
}
void f_JIT_步进im(const S_I32Array* x, const S_I32Array* y, S_I32Array* a, uint8 方式) {
	uint32 num = DEF_Max(x->count, y->count);
	f_core_array_resize((S_Array*)a, num);

	bool x多例 = x->count >= num;
	bool y多例 = y->count >= num;

	for (uint32 i = 0; i < num; ++i) {
		a->ptr_userData[i] = f_JIT_步进i(x多例 ? x->ptr_userData[i] : x->ptr_userData[0], y多例 ? y->ptr_userData[i] : y->ptr_userData[0], 方式);
	}
}


void f_JIT_坐标变换m(const S_Vec3Array* vert, const S_Vec3Array* loc, const S_Vec3Array* rot, const S_Vec3Array* scal, S_Vec3Array* t) {
	uint32 num = t->count;
	if(!num) return;

	num = DEF_Max(num, loc->count);
	num = DEF_Max(num, rot->count);
	num = DEF_Max(num, scal->count);
	num = DEF_Max(num, vert->count);

	f_core_array_resize((S_Array*)t, num);

	bool 独立1 = loc->count >= num;
	bool 独立2 = rot->count >= num;
	bool 独立3 = scal->count >= num;
	bool 独立4 = vert->count >= num;

//#pragma omp parallel for
	for (int32 i = 0; i < num; ++i) {
		vec3 l;
		if(独立1) l = loc->ptr_userData[i];
		else l = loc->ptr_userData[0];

		vec3 r;
		if(独立2) r = rot->ptr_userData[i];
		else r = rot->ptr_userData[0];

		vec3 s;
		if(独立3) s = scal->ptr_userData[i];
		else s = scal->ptr_userData[0];

		vec3 v;
		if(独立4) v = vert->ptr_userData[i];
		else v = vert->ptr_userData[0];


		t->ptr_userData[i] = f_JIT_坐标变换(v, l, r, s);
	}
}

void f_JIT_位运算Um(const S_UI32Array* x, const S_UI32Array* y, S_UI32Array* a, uint8 方式) {
	uint32 num = DEF_Max(x->count, y->count);
	f_core_array_resize((S_Array*)a, num);

	bool x多例 = x->count >= num;
	bool y多例 = y->count >= num;


#pragma omp parallel for
	for (int32 i = 0; i < num; ++i) {
		a->ptr_userData[i] = f_JIT_位运算U(x多例 ? x->ptr_userData[i] : x->ptr_userData[0], y多例 ? y->ptr_userData[i] : y->ptr_userData[0], 方式);
	}
}

void f_node_所有计算类节点JIT初始化() {
	f_代码构建_添加JIT初始化函数指针(DEF_S(vec3_len), DEF_S(float32), "const vec3& vec", vec3_len);

	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fn_逻辑计算), DEF_S(void), "float32, float32, int8&, uint8", f_JIT_Fn_逻辑计算);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fn_逻辑计算m), DEF_S(void),  "S_F32Array*, S_F32Array*, S_I8Array*, uint8", f_JIT_Fn_逻辑计算m);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fun_F32s_c_F32s), "void", "S_F32Array* r, S_F32Array* a, S_F32Array* b, uint8 方式", f_JIT_Fun_F32s_c_F32s);

	f_代码构建_添加JIT初始化函数指针(DEF_S(f_graph_计算圆坐标v3_JIT), "void", "const vec3 中心, const float32 半径, uint32 细分, S_Vec3Array* 结果", f_graph_计算圆坐标v3_JIT);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_graph_计算直线坐标), "void", "vec3 方向, float32 长度, uint32 细分, void* data", f_graph_计算直线坐标);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_graph_构建平面坐标), "void", "vec3 大小, uvec3 细分, S_Vec3Array* data", f_graph_构建平面坐标);
	f_代码构建_添加JIT初始化函数指针(DEF_S(vec_add_3_1), "vec3", "const vec3& vec, const float32& 加数向量", vec_add_3_1);
	f_代码构建_添加JIT初始化函数指针(DEF_S(vec_add_3_3), "vec3", "const vec3& vec, vec3& 加数向量", vec_add_3_3);
	f_代码构建_添加JIT初始化函数指针(DEF_S(vec_multi_3_3), "vec3", "const vec3& vec, vec3& 加数向量", vec_multi_3_3);

	

	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fun_vec3_c_f32), "vec3", DEF_S(DEF_V3_F_参数), f_JIT_Fun_vec3_c_f32);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fun_vec3_c_vec3), "vec3", DEF_S(DEF_V3_V3_参数), f_JIT_Fun_vec3_c_vec3);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fun_vec3s_c_f), "void", DEF_S(DEF_V3S_F_参数), f_JIT_Fun_vec3s_c_f);

	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fun_vec3s_c_fs), "void", DEF_S(DEF_V3S_Fs_参数), f_JIT_Fun_vec3s_c_fs);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fun_vec3s_c_vec3s), "void", DEF_S(DEF_V3s_V3s_参数), f_JIT_Fun_vec3s_c_vec3s);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_单值数组计算), DEF_S(void), "S_I32Array*, S_I32Array*, S_I32Array*, uint8", f_JIT_单值数组计算);

	f_代码构建_添加JIT初始化函数指针(DEF_S(f_mat44_构建移动矩阵), "Mat44f", "const vec3& s", f_mat44_构建移动矩阵);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_mat44_构建缩放矩阵), "Mat44f", "const vec3& s", f_mat44_构建缩放矩阵);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_mat44_构建行式旋转矩阵), "Mat44f", "const vec3& a, float32 angle", f_mat44_构建行式旋转矩阵);

	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fun_矩阵计算_mm), "Mat44f", DEF_S(DEF_构建矩阵_m_m_参数), f_JIT_Fun_矩阵计算_mms);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fun_矩阵计算_mms), "void*", DEF_S(DEF_构建矩阵_m_ms_参数), f_JIT_Fun_矩阵计算_mms);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fun_矩阵计算_msm), "void*", DEF_S(DEF_构建矩阵_ms_m_参数), f_JIT_Fun_矩阵计算_msm);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fun_矩阵计算_msms), "void*", DEF_S(DEF_构建矩阵_ms_ms_参数), f_JIT_Fun_矩阵计算_msms);

	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fun_矩阵变换_vs_m), "void*", DEF_S(DEF_构建矩阵_vs_m_参数), f_JIT_Fun_矩阵变换_vs_m);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fun_矩阵变换_v_ms), "void*", DEF_S(DEF_构建矩阵_v_ms_参数), f_JIT_Fun_矩阵变换_v_ms);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fun_矩阵变换_vs_ms), "void*", DEF_S(DEF_构建矩阵_vs_ms_参数), f_JIT_Fun_矩阵变换_vs_ms);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_坐标变换), DEF_S(vec3), "const vec3&, const vec3&, const vec3&, const vec3&", f_JIT_坐标变换);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_坐标变换m), DEF_S(void), "const S_Vec3Array*, const S_Vec3Array*, const S_Vec3Array*, const S_Vec3Array*, S_Vec3Array*", f_JIT_坐标变换m);
	

	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fn_三角函数s), "void", "S_F32Array* inData, S_F32Array* outData, uint8 type", f_JIT_Fn_三角函数s);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fn_三角函数), "float32", "float32 inData, uint8 type", f_JIT_Fn_三角函数);
	//f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fn_向量归一化s), "void", "S_Vec3Array * inData, S_Vec3Array * outData", f_JIT_Fn_向量归一化s);

	//f_代码构建_添加JIT初始化函数指针(DEF_S(vec_len), "float32", "const vec3& vec", vec_len);
	f_代码构建_添加JIT初始化函数指针(DEF_S(vec_3转4), "vec4", "const vec3& vec, const float32 填充数", vec_3转4);
	f_代码构建_添加JIT初始化函数指针(DEF_S(vec_4转3), "vec3", "const vec4& vec", vec_4转3);
	f_代码构建_添加JIT初始化函数指针(DEF_S(vec_f3转u2), "uvec2", "const vec3& vec", vec_f3转u2);

	f_代码构建_添加JIT初始化函数指针(DEF_S(f_math_向量长度m), DEF_S(void), "S_F32Array*, const S_Vec3Array*, uint8", f_math_向量长度m);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_math_向量归一化), "vec3", "const vec3& dirA, uint8 type", f_math_向量归一化);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_math_向量归一化m), "void", "const S_Vec3Array* dirA, S_Vec3Array* r, uint8 type", f_math_向量归一化m);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_math_两向量标量), "float32", "const vec3& dirA, const vec3& dirB, uint8 type", f_math_两向量标量);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_math_两向量标量m), "void", "const S_Vec3Array* dirA, const S_Vec3Array* dirB, S_F32Array* r, uint8 type", f_math_两向量标量m);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_math_两向量叉积), "vec3", "const vec3& dirA, const vec3& dirB", f_math_两向量叉积);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_math_两向量叉积m), "void", "const S_Vec3Array* dirA, const S_Vec3Array* dirB, S_Vec3Array* r", f_math_两向量叉积m);

	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fn_混合m), DEF_S(void), "const S_F32Array*, const S_F32Array*, const S_F32Array*, S_F32Array*", f_JIT_Fn_混合m);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fn_矢量混合m), DEF_S(void), "const S_Vec3Array*, const S_Vec3Array*, const S_F32Array*, S_Vec3Array*", f_JIT_Fn_混合m);

	f_代码构建_添加JIT初始化函数指针(DEF_S(f_graph_quat相乘), "vec4", "const vec4& q1, const vec4& q2", f_graph_quat相乘);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_graph_quat两向量), "vec4", "const vec3& v, const vec3& q2", f_graph_quat两向量);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_graph_quat变换坐标), "vec3", "const vec4& v, const vec3& q2", f_graph_quat变换坐标);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_graph_钳制曲线采样), "float32", "float32  采样位置, const S_曲线& curve, const vec2 钳制", f_graph_钳制曲线采样);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_graph_旋转角转四元数), DEF_S(vec4), "const vec3& 归一化向量, float 弧度", f_graph_旋转角转四元数);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_graph_quatTranform), DEF_S(vec3), "const vec4& q, const vec3& pos", f_graph_quatTranform);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_graph_quat反向变换坐标), DEF_S(vec3), "const vec4& q, const vec3& pos", f_graph_quat反向变换坐标);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_graph_从轴向角度计算四元数), DEF_S(vec4), "const vec3&, float", f_graph_从轴向角度计算四元数);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_math_quat相乘m), "void", "const S_Vec4Array* dirA, const S_Vec4Array* dirB, S_Vec4Array* r", f_math_quat相乘m);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_math_quat以轴向和角度构建m), "void", "S_Vec4Array* quat, const S_Vec3Array* v, const S_F32Array* a", f_math_quat以轴向和角度构建m);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_math_绕点旋转), DEF_S(vec3), "const vec3&, const vec3&, const float32, const vec3&", f_math_绕点旋转);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_math_绕点旋转m), DEF_S(void), "S_Vec3Array*, const S_Vec3Array*, const S_Vec3Array*, const S_F32Array*, const vec3&", f_math_绕点旋转m);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_math_轴向旋转变换), DEF_S(vec3), "vec3, vec3, float32, int32", f_math_轴向旋转变换);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_math_轴向旋转变换m), DEF_S(void), "S_Vec3Array*, const S_Vec3Array*, const S_Vec3Array*, S_F32Array*, int32", f_math_轴向旋转变换m);



	f_代码构建_添加JIT初始化函数指针(DEF_S(f_graph_四元数转欧拉角), DEF_S(vec3), "const vec4& quat", f_graph_四元数转欧拉角);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_mat3x3_quat), DEF_S(mat3X3), "const vec4& quat", f_mat3x3_quat);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_mat4x4_quat), DEF_S(Mat44f), "const vec4& quat", f_mat4x4_quat);

	f_代码构建_添加JIT初始化函数指针(DEF_S(f_math_quat变换m), "void", "const S_Vec3Array* dirA, const S_Vec4Array* dirB, S_Vec3Array* r, int32", f_math_quat变换m);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_math_四元数转欧拉角m), "void", "const S_Vec4Array* quat, S_Vec3Array* r", f_math_四元数转欧拉角m);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_math_四元数转3X3矩阵m), "void", "const S_Vec4Array* quat, S_Mat33Array* r", f_math_四元数转3X3矩阵m);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_math_四元数转4X4矩阵m), "void", "const S_Vec4Array* quat, S_Mat44Array* r", f_math_四元数转4X4矩阵m);

	f_代码构建_添加JIT初始化函数指针(DEF_S(f_math_mat44_变换m), "void", "const S_Vec3Array* dirA, const S_Mat44Array* dirB, S_Vec3Array* r", f_math_mat44_变换m);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_math_mat44_相乘), "Mat44f", "const Mat44f& dirA, const Mat44f& dirB", f_math_mat44_相乘);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_math_mat44_相乘m), "void", "const S_Mat44Array* dirA, const S_Mat44Array* dirB, S_Mat44Array* r", f_math_mat44_相乘m);

	f_代码构建_添加JIT初始化函数指针(DEF_S(f_mat_平面构建), "void", "const S_Vec3Array*, S_Vec4Array*", f_mat_平面构建);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_graph_顶点构建平面), "vec4", "const vec3 point[3]", f_graph_顶点构建平面);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_mat_点到平面距离), "void", "const S_Vec3Array*, const S_Vec4Array*, S_F32Array*", f_mat_点到平面距离);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_graph_点到平面距离), "float32", "const vec3&, const vec4&", f_graph_点到平面距离);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_graph_射线相交平面2), "bool", "const vec3&, const vec3&, const vec4&, vec3&", f_graph_射线相交平面2);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_mat_射线平面相交), DEF_S(void), "const S_Vec3Array*, const S_Vec4Array*, S_Vec3Array*", f_mat_射线平面相交);

	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_旋转向量节点), DEF_S(void), "S_Vec3Array * 向量, const S_Vec3Array * 法线, const S_Vec2Array * UV, uint8 方式", f_JIT_旋转向量节点);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_SphereSampling), DEF_S(vec3), "vec2 uv", f_SphereSampling);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_SphereSampling_toWorld), DEF_S(vec3), "vec3 ss, vec3 N", f_SphereSampling_toWorld);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_曲线采样), DEF_S(void), "S_F32Array* 值, const S_曲线& curve, const S_F32Array* 步进, const vec2& 钳制", f_JIT_曲线采样);

	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fn_设置矢量分量), DEF_S(vec3), "const vec3& 矢量, float32 分量, int8 分量ID", f_JIT_Fn_设置矢量分量);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_Fn_设置矢量分量m), DEF_S(void), "const S_Vec3Array*, const S_F32Array*, int8, S_Vec3Array*", f_JIT_Fn_设置矢量分量m);

	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_步进f), DEF_S(float32), "float32& x, float32& edge, uint8 方式", f_JIT_步进f);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_步进i), DEF_S(int32), "int32& x, int32& edge, uint8 方式", f_JIT_步进i);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_步进fm), DEF_S(void), "const S_F32Array* x, const S_F32Array* y, S_F32Array* a, uint8 方式", f_JIT_步进fm);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_步进im), DEF_S(void), "const S_I32Array* x, const S_I32Array* y, S_I32Array* a, uint8 方式", f_JIT_步进im);
	
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_位运算U), DEF_S(uint32), "uint32 a, uint32 b, uint8 方式", f_JIT_位运算U);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_位运算Uxx), DEF_S(void), "uint32& a, const uint32& b, uint8 方式", f_JIT_位运算Uxx);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_位运算Um), DEF_S(void), "const S_UI32Array* x, const S_UI32Array* y, S_UI32Array* a, uint8 方式", f_JIT_位运算Um);
	//f_代码构建_添加JIT初始化函数指针(DEF_S(length), "float32", "float32 x", length);

}



